﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CCH.DAO;
using CCH.Entity;
using CCH.Lib;

public partial class _60_6002_1 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            this.lab_menu.Text = new sysfunctionDAO().Get_titleName(6002) + " - 回覆留言";

            board data = new boardDAO().Get_board(int.Parse(Request.QueryString["ID"]));

            this.lab_datetime.Text = data.boa_datetime.Value.ConvertToROCDT();
            this.lab_name.Text = data.boa_name;
            this.lab_title.Text = data.boa_title;
            this.lab_post.Text = data.boa_post;

            this.TextBox1.Text = data.boa_reply.ConvertToNewLine();
        }
    }

    protected void btn_ok_Click(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(this.TextBox1.Text))
        {
            JsUtil.AlertJs(this, "請輸入回覆!!");
        }
        else
        {
            boardDAO dao = new boardDAO();
            board data = dao.Get_board(int.Parse(Request.QueryString["ID"]));

            data.boa_isReply = "2";
            data.boa_replyID = new SessionObject().SessionUserID;
            data.boa_replyDT=DateTime.Now;
            data.boa_reply = this.TextBox1.Text.ConvertToBR();

            dao.Update();

            JsUtil.UpdateParentJs(this,"回覆完成!");
        }
    }
}